package API.Spider.CreedyAndNotCreedySpider;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Example {
    public static void main(String[] args) {
        String str = "abbbbbabbabbbbbabbbbabbbbabbb";
        Pattern pattern1 = Pattern.compile("ab+");
        Pattern pattern2 = Pattern.compile("ab+?");
        Matcher matcher1 = pattern1.matcher(str);
        Matcher matcher2 = pattern2.matcher(str);
        while(matcher1.find()){
            System.out.println(matcher1.group());
        }
        while(matcher2.find()){
            System.out.println(matcher2.group());
        }
    }
}
